package com.easylive.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: yudaxian
 * @Description: 用户性别
 * @DateTime: 2024/11/2 19:43
 **/
@AllArgsConstructor
@Getter
public enum UserSexEnum {
    MALE(1, "男"),
    FEMALE(0, "女"),
    UNKNOWN(2, "未知");
    ;

    private Integer code;

    private String desc;

    public static UserSexEnum getByCode(Integer code) {
        for (UserSexEnum userSexEnum : UserSexEnum.values()) {
            if (userSexEnum.getCode().equals(code)) {
                return userSexEnum;
            }
        }
        return null;
    }
}
